package com.ruoyi.ruoyiqywechat.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.ruoyiqywechat.mapper.UserMembershipMapper;
import com.ruoyi.ruoyiqywechat.domain.UserMembership;
import com.ruoyi.ruoyiqywechat.service.IUserMembershipService;

/**
 * 用户会员Service业务层处理
 *
 * @author 好六
 * @date 2025-10-10
 */
@Service
public class UserMembershipServiceImpl extends ServiceImpl<UserMembershipMapper,UserMembership> implements IUserMembershipService
{
    @Autowired
    private UserMembershipMapper userMembershipMapper;

    /**
     * 查询用户会员
     *
     * @param id 用户会员主键
     * @return 用户会员
     */
    @Override
    public UserMembership selectUserMembershipById(Long id)
    {
        return userMembershipMapper.selectUserMembershipById(id);
    }

    /**
     * 查询用户会员列表
     *
     * @param userMembership 用户会员
     * @return 用户会员
     */
    @Override
    public List<UserMembership> selectUserMembershipList(UserMembership userMembership)
    {
        return userMembershipMapper.selectUserMembershipList(userMembership);
    }

    /**
     * 新增用户会员
     *
     * @param userMembership 用户会员
     * @return 结果
     */
    @Override
    public int insertUserMembership(UserMembership userMembership)
    {
        userMembership.setCreateTime(DateUtils.getNowDate());
        return userMembershipMapper.insertUserMembership(userMembership);
    }

    /**
     * 修改用户会员
     *
     * @param userMembership 用户会员
     * @return 结果
     */
    @Override
    public int updateUserMembership(UserMembership userMembership)
    {
        userMembership.setUpdateTime(DateUtils.getNowDate());
        return userMembershipMapper.updateUserMembership(userMembership);
    }

    /**
     * 批量删除用户会员
     *
     * @param ids 需要删除的用户会员主键
     * @return 结果
     */
    @Override
    public int deleteUserMembershipByIds(Long[] ids)
    {
        return userMembershipMapper.deleteUserMembershipByIds(ids);
    }

    /**
     * 删除用户会员信息
     *
     * @param id 用户会员主键
     * @return 结果
     */
    @Override
    public int deleteUserMembershipById(Long id)
    {
        return userMembershipMapper.deleteUserMembershipById(id);
    }
}
